package com.glzn.springboot03.service.impl;

import com.glzn.springboot03.entity.User;
import com.glzn.springboot03.mapper.UserMapper;
import com.glzn.springboot03.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author gongjq
 */
@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserMapper userMapper;

	@Override
	public User findByLogin(String login, String password) throws Exception {
		User user = userMapper.findByLogin(login);
		if (null == user){
			throw new Exception("登录名不正确");
		}else if(!user.getPassword().equals(password)){
			throw new Exception("密码不正确");
		}
		return user;
	}
}
